package mr.fileToFile;

import java.io.IOException;
import java.io.PrintWriter;

import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;

/**
 * 
 * @author 李岩飞
 * @email eliyanfei@126.com	
 * 2017年12月18日 上午10:16:59
 *
 */
public class S1MMERecordWriter extends RecordWriter<Text, Text> {
	private PrintWriter out;

	public S1MMERecordWriter(FSDataOutputStream fileOut) {
		out = new PrintWriter(fileOut);
	}

	@Override
	public void write(Text key, Text value) throws IOException, InterruptedException {
		out.println(key.toString() + "," + value.toString());
	}

	@Override
	public void close(TaskAttemptContext context) throws IOException, InterruptedException {
		out.close();
	}

}